using DTFramework.Scriptable;
using UnityGameFramework.Runtime;
using WebRequestComponent = DTFramework.WebRequest.WebRequestComponent;

namespace DTFramework
{
    /// <summary>
    /// 游戏入口 - 核心功能
    /// </summary>
    public partial class GameEntry
    {
        /// <summary>
        /// 构建数据组件。
        /// </summary>
        public static BuiltinDataComponent BuiltinData { get; private set; }
        /// <summary>
        /// 基础组件
        /// </summary>
        public static BaseComponent Base { get; private set; }
        /// <summary>
        /// 获取Scriptable组件。
        /// </summary>
        public static ScriptableComponent Scriptable { get; private set; }
        /// <summary>
        /// 获取数据结点组件。
        /// </summary>
        public static DataNodeComponent DataNode { get; private set; }
        /// <summary>
        /// 获取数据表组件。
        /// </summary>
        public static DataTableComponent DataTable { get; private set; }
        /// <summary>
        /// 获取下载组件。
        /// </summary>
        public static DownloadComponent Download { get; private set; }
        /// <summary>
        /// 获取实体组件。
        /// </summary>
        public static EntityComponent Entity { get; private set; }
        /// <summary>
        /// 获取事件组件。
        /// </summary>
        public static EventComponent Event { get; private set; }
        /// <summary>
        /// 获取文件系统组件。
        /// </summary>
        public static FileSystemComponent FileSystem { get; private set; }
        /// <summary>
        /// 获取有限状态机组件。
        /// </summary>
        public static FsmComponent Fsm { get; private set; }
        /// <summary>
        /// 获取网络组件。
        /// </summary>
        public static NetworkComponent Network { get; private set; }
        /// <summary>
        /// 获取对象池组件。
        /// </summary>
        public static ObjectPoolComponent ObjectPool { get; private set; }
        /// <summary>
        /// 获取流程组件。
        /// </summary>
        public static ProcedureComponent Procedure { get; private set; }
        /// <summary>
        /// 获取资源组件。
        /// </summary>
        public static ResourceComponent Resource { get; private set; }
        /// <summary>
        /// 获取场景组件。
        /// </summary>
        public static SceneComponent Scene { get; private set; }
        /// <summary>
        /// 获取设置组件。
        /// </summary>
        public static SettingComponent Setting { get; private set; }
        /// <summary>
        /// 获取声音组件。
        /// </summary>
        public static SoundComponent Sound { get; private set; }
        /// <summary>
        /// 获取界面组件。
        /// </summary>
        public static UIComponent UI { get; private set; }
        /// <summary>
        /// 获取网络组件。
        /// </summary>
        public static WebRequestComponent WebRequest { get; private set; }

        private void InitBuiltinComponents()
        {
            BuiltinData = UnityGameFramework.Runtime.GameEntry.GetComponent<BuiltinDataComponent>();
            Base = UnityGameFramework.Runtime.GameEntry.GetComponent<BaseComponent>();
            Scriptable = UnityGameFramework.Runtime.GameEntry.GetComponent<ScriptableComponent>();
            DataNode = UnityGameFramework.Runtime.GameEntry.GetComponent<DataNodeComponent>();
            DataTable = UnityGameFramework.Runtime.GameEntry.GetComponent<DataTableComponent>();
            Download = UnityGameFramework.Runtime.GameEntry.GetComponent<DownloadComponent>();
            Entity = UnityGameFramework.Runtime.GameEntry.GetComponent<EntityComponent>();
            Event = UnityGameFramework.Runtime.GameEntry.GetComponent<EventComponent>();
            FileSystem = UnityGameFramework.Runtime.GameEntry.GetComponent<FileSystemComponent>();
            Fsm = UnityGameFramework.Runtime.GameEntry.GetComponent<FsmComponent>();
            Network = UnityGameFramework.Runtime.GameEntry.GetComponent<NetworkComponent>();
            ObjectPool = UnityGameFramework.Runtime.GameEntry.GetComponent<ObjectPoolComponent>();
            Procedure = UnityGameFramework.Runtime.GameEntry.GetComponent<ProcedureComponent>();
            Resource = UnityGameFramework.Runtime.GameEntry.GetComponent<ResourceComponent>();
            Scene = UnityGameFramework.Runtime.GameEntry.GetComponent<SceneComponent>();
            Setting = UnityGameFramework.Runtime.GameEntry.GetComponent<SettingComponent>();
            Sound = UnityGameFramework.Runtime.GameEntry.GetComponent<SoundComponent>();
            UI = UnityGameFramework.Runtime.GameEntry.GetComponent<UIComponent>();
            WebRequest = UnityGameFramework.Runtime.GameEntry.GetComponent<WebRequestComponent>();
        }
    }
}
